// pages/mine/magicBox/magicBox.js
var app = getApp();
import p from "../../../utils/platform";
Page({

  /**
   * 页面的初始数据
   */
  data: {
    box: [
      {
        img: '../images/box_rader.png',
        title: '房雷达',
        fuc: 'goToRadar'
      },{
        img: '../images/box_video.png',
        title: '视频教程',
        fuc: 'goToProductTutorial'
      }
    ],
    addBox: 0,
  },
  goToRadar() {
    app
      .mobileLogin(null, "房雷达")
      .then(() => {
        p.navigateTo({ url: "/pages/gatherHouse/radarHouse/radarHouse" });
      })
      .catch(() => {
        app.globalData.afterMobileAuthorCallBack = () => {
          p.redirectTo({ url: "/pages/gatherHouse/radarHouse/radarHouse" });
        };
      });
  },
  goToProductTutorial() {
    wx.navigateTo({
      url: "/pages/gatherHouse/productTutorial/prodctTutorial",
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let addBox = 0;
    addBox = 4 - this.data.box.length%4;
    this.setData({
      addBox: addBox==4? 0 : addBox
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
})